package com.uflower.order.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;


public class CartItemVo {
    private Long skuId;

    private Boolean check;

    private String title;

    private String image;

    private List<String> skuAttrValues;

    private BigDecimal price;

    public FullReduce getFullReduce() {
        return fullReduce;
    }

    public void setFullReduce(FullReduce fullReduce) {
        this.fullReduce = fullReduce;
    }

    private Integer count;

    private FullReduce fullReduce;

    private BigDecimal totalPrice;

    private BigDecimal reduce;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class FullReduce{
        BigDecimal fullPrice;

        BigDecimal reducePrice;

    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public Boolean getCheck() {
        return check;
    }

    public void setCheck(Boolean check) {
        this.check = check;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public List<String> getSkuAttrValues() {
        return skuAttrValues;
    }

    public void setSkuAttrValues(List<String> skuAttrValues) {
        this.skuAttrValues = skuAttrValues;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public BigDecimal getTotalPrice() {
        return this.price.multiply(new BigDecimal(this.count));
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }

    public BigDecimal getReduce() {
        BigDecimal reduce = new BigDecimal("0");
        if(fullReduce != null){
            if(this.getTotalPrice().compareTo(this.fullReduce.fullPrice) > -1){
                reduce.add(this.fullReduce.reducePrice);
            }
        }
        return reduce;
    }

    public void setReduce(BigDecimal reduce) {
        this.reduce = reduce;
    }



}
